jade.wrapper
Class Agent

java.lang.Object
  |
  +--jade.wrapper.Agent

public class Agent
extends java.lang.Object

This class is a Proxy class, allowing access to a JADE agent. Invoking methods on instances of this class, it is possible to trigger state transition of the agent life cycle. This class must not be instantiated by applications. Instead, use the createAgent() method in class AgentContainer.

Author:
Giovanni Rimassa - Universita` di Parma
See Also:
throws NotFoundException, StaleProxyException

Method Summary
 void activate()
          Triggers a state transition from SUSPENDED to ACTIVE.
 void clone(Location where, java.lang.String newName)
          Clones the current agent.
 void delete()
          Triggers a state transition from ACTIVE to DELETED.
 void move(Location where)
          Triggers a state transition from ACTIVE to TRANSIT.
 void start()
          Triggers a state transition from INITIATED to ACTIVE.
 void suspend()
          Triggers a state transition from ACTIVE to SUSPENDED.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

start

public void start()
           throws StaleProxyException
Triggers a state transition from INITIATED to ACTIVE. This call also starts the internal agent thread. If this call is performed on an already started agent, nothing happens.
Throws:
StaleProxyException - If the underlying agent is dead or gone.

suspend

public void suspend()
             throws StaleProxyException
Triggers a state transition from ACTIVE to SUSPENDED.
Throws:
StaleProxyException - If the underlying agent is dead or gone.

activate

public void activate()
              throws StaleProxyException
Triggers a state transition from SUSPENDED to ACTIVE.
Throws:
StaleProxyException - If the underlying agent is dead or gone.

delete

public void delete()
            throws StaleProxyException
Triggers a state transition from ACTIVE to DELETED. This call also stops the internal agent thread and fully terminates the agent. If this call is performed on an already terminated agent, nothing happens.
Throws:
StaleProxyException - If the underlying agent is dead or gone.

move

public void move(Location where)
          throws StaleProxyException
Triggers a state transition from ACTIVE to TRANSIT. This call also moves the agent code and data to another container. This calls terminates the locally running agent, so that this proxy object becomes detached from the moved agent that keeps on executing elsewhere (i.e., no proxy remotization is performed).
Parameters:
where - A Location object, representing the container the agent should move to.
Throws:
StaleProxyException - If the underlying agent is dead or gone.

clone

public void clone(Location where,
                  java.lang.String newName)
           throws StaleProxyException
Clones the current agent. Calling this method does not really trigger a state transition in the current agent lifecycle. Rather, it creates another agent on the given location, that is just a copy of this agent.
Parameters:
where - The Location object, representing the container where the new agent copy will start.
newName - The new nickname to give to the copy.
Throws:
StaleProxyException - If the underlying agent is dead or gone.